You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: keep a missing Gemfile lock path absent during collection lockfile serialization instead of raising by calling to_s on nil.
Verification: focused baseline/fixed reproduction, combined RBS 4.2.0 consumer models, and RuboCop (738 files, zero offenses). No tests are added in this PR.
Compatibility: no public API removal or dependency/version change.
Thank you, the change itself is right and I am planning to merge it. One correction to the description, for the record.
nil.to_s does not raise; it returns "". So nothing blows up at serialization time. What actually goes wrong is quieter, and it happens on the way back in:
to_lockfile writes gemfile_lock_path: '' when gemfile_lock_path is nil.
Lockfile.from_lockfile tests if p = data["gemfile_lock_path"], and "" is truthy in Ruby, so it builds Pathname("") instead of leaving the path absent.
gemfile_lock_fullpath then returns lockfile_dir + Pathname(""), which is lockfile_dir itself.
LockfileGenerator#validate_gemfile_lock_path! compares that directory against the real Gemfile.lock and raises GemfileLockMismatchError.
So the bug is a wrong value round-tripping through the lockfile rather than a NoMethodError, and &.to_s is the right fix because lockfile_data already declares "gemfile_lock_path" => String?.
It is also worth noting that LockfileGenerator always passes definition.lockfile.relative_path_from(lockfile_dir), so rbs collection itself never reaches this today. It matters for callers that build a Lockfile directly, and for a lockfile written before we added the key.
I have rebased the branch onto the current master. The test (head, stdlib_test rubocop) failure was an unrelated Net::HTTP test on ruby-head and is fixed there now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary: keep a missing Gemfile lock path absent during collection lockfile serialization instead of raising by calling to_s on nil.
Verification: focused baseline/fixed reproduction, combined RBS 4.2.0 consumer models, and RuboCop (738 files, zero offenses). No tests are added in this PR.
Compatibility: no public API removal or dependency/version change.